From 6980857435816ff050b9bcb5691df5a22bc02610 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Mon, 6 Nov 2006 04:38:50 +0000 Subject: [PATCH] (bug 98) Prohibit corner-case where it might be possible to create a page beginning with a forward slash. Patch by Werdna. --- RELEASE-NOTES | 2 ++ includes/Title.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f5f17fb6de..fd7d96aaeb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -146,6 +146,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Allow case-sensitive URLs to be used for uploading from URLs. * (bug 1109) Correct fix for compressed 304 responses when additional output buffers have been installed within the compression handler +* (bug 98) Prohibit corner-case where it might be possible to create a page + beginning with a forward slash. == Languages updated == diff --git a/includes/Title.php b/includes/Title.php index b81b63176b..55bda5c9fc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1551,6 +1551,16 @@ class Title { return false; } + /** + * Pages whose titles start with / can confuse webservers + * and proxies. They can be unreachable with the pretty + * URLs. Forbid them explicitly. + */ + if ( strpos( $r, '/') === 0 ) + { + return false; + } + # We shouldn't need to query the DB for the size. #$maxSize = $dbr->textFieldSize( 'page', 'page_title' ); if ( strlen( $r ) > 255 ) { @@ -2298,7 +2308,7 @@ class Title { * @deprecated use DependencyWrapper */ function getRelatedCache( $memc, $key, $expiry, $callback, $params = array() ) { - return DependencyWrapper::getValueFromCache( $memc, $key, $expiry, $callback, + return DependencyWrapper::getValueFromCache( $memc, $key, $expiry, $callback, $params, new TitleDependency( $this ) ); } -- 2.20.1